package com.xgk.boot.module.core.dal.mapper.price;

import com.xgk.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.xgk.boot.module.core.dal.entity.channel.ApiServiceDO;
import com.xgk.boot.module.core.dal.entity.price.PriceRuleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PriceRuleMapper extends BaseMapperX<PriceRuleDO> {


    @Select("SELECT a.* FROM price_rule a " +
            "JOIN product_price_rule r ON r.pr_id = a.id  " +
            "WHERE r.p_id = #{pId} AND r.pr_type= #{prType} and a.r_status = 0 and a.deleted =0")
    List<PriceRuleDO> selectPriceRuleByProductAndType(@Param("pId") Long pId, @Param("prType") Integer prType);

}
